import "../css/NifiSQL-BJxHxIQO.css";
import { defineComponent as g, toRefs as x, computed as w, ref as f, openBlock as q, createElementBlock as y, createElementVNode as o, createVNode as m, unref as i, withCtx as C, createTextVNode as V, toDisplayString as S, pushScopeId as E, popScopeId as b } from "vue";
import { bK as N, b5 as k, f as F } from "./vendor.CF2kwqqq.js";
import { C as I } from "./main.DDNsfpKl.js";
import { _ as R } from "./_plugin-vue_export-helper.CHgC5LLL.js";
const _ = (s) => (E("data-v-4732902a"), s = s(), b(), s), T = {
  "w-full": "",
  "h-full": "",
  "overflow-auto": ""
}, B = {
  flex: "",
  "items-center": "",
  "gap-16": ""
}, D = /* @__PURE__ */ _(() => /* @__PURE__ */ o("span", {
  "w-100": "",
  "text-nowrap": "",
  "self-start": ""
}, "输入源", -1)), K = {
  class: "flex flex-1 flex-wrap",
  style: { width: "calc(100% - 100px)" }
}, L = /* @__PURE__ */ _(() => /* @__PURE__ */ o("div", { class: "flex items-center mb-5" }, [
  /* @__PURE__ */ o("div", { "w-100": "" }, "SQL 语句")
], -1)), Q = {
  "w-full": "",
  style: { height: "calc(100% - 40px)" }
}, $ = {
  relative: "",
  "w-full": "",
  "h-full": "",
  flex: "",
  "flex-col": "",
  "overflow-hidden": ""
}, U = {
  "min-h-100": "",
  style: { height: "calc(100% - 32px)" }
}, j = /* @__PURE__ */ g({
  __name: "sqlConfig",
  props: {
    source: { default: () => "" },
    formVal: {},
    preview: {}
  },
  emits: ["change", "update:sql"],
  setup(s, { emit: p }) {
    const a = s, c = p, { source: u, formVal: r } = x(a), e = w({
      get: () => {
        var t, l;
        return (l = (t = r.value) == null ? void 0 : t.config) == null ? void 0 : l.properties["sql-query"];
      },
      set: (t) => {
        c("update:sql", t);
      }
    }), n = (t) => {
      e.value = t;
    };
    function h(t) {
      let l = e.value ? t : `select * from ${t}`;
      d.value.insertValue(l);
    }
    const v = f([N()]), d = f();
    return (t, l) => (q(), y("div", T, [
      o("div", B, [
        D,
        o("div", K, [
          m(i(k), {
            type: "primary",
            effect: "light",
            class: "mr-10 mb-10 cursor-pointer",
            onClick: l[0] || (l[0] = (A) => h(i(u)))
          }, {
            default: C(() => [
              V(S(i(u)), 1)
            ]),
            _: 1
          })
        ])
      ]),
      L,
      o("div", Q, [
        o("div", $, [
          o("div", U, [
            m(i(I), {
              ref_key: "codeEditorRef",
              ref: d,
              "model-value": e.value,
              "onUpdate:modelValue": n,
              lang: v.value,
              class: "w-full h-full"
            }, null, 8, ["model-value", "lang"])
          ])
        ])
      ])
    ]));
  }
}), z = /* @__PURE__ */ R(j, [["__scopeId", "data-v-4732902a"]]), P = () => {
  const s = ["org.apache.nifi.sql.processors.NifiSQL"], p = ["input", "output", "input字段（自动填入）", "output字段（自动填入）"], a = f(""), c = f();
  return { name: s, excludeKeys: p, selfFormColumn: [{
    tag: z,
    ":formdata": "formData",
    prop: "config.properties",
    isFormElem: !1,
    label: "",
    ":data": "formData",
    setup({ params: r }) {
      var n;
      const { formData: e } = r;
      a.value = (n = e == null ? void 0 : e.config) == null ? void 0 : n.properties["table-name"], c.value = e;
    },
    "@update:sql": ({ formData: r, $: e }) => {
      F(r, ["config", "properties", "sql-query"], e[0]);
    },
    source: a,
    formVal: c
  }] };
};
export {
  P as default
};
